package com.dodo.blog.ui.component.input;

import com.dodo.blog.ui.ajax.AjaxRequestHandler;
import com.dodo.blog.ui.component.container.Container;

/**
 * @author <a href="mailto:pohorelec@comvai.com">Jozef Pohorelec</a>
 */
public class Button
        extends Container
{
    private static final long serialVersionUID = 1L;

    public Button( String id, String text )
    {
        this( id, id, text );
    }

    public Button( String name, String id, String text )
    {
        super( Tag.BUTTON );
        setId( id );
        setName( name );
        setInnerHtml( text );
    }

    public Button setAjaxMethod( String method )
    {
        setAttribute( "ajax-method", method );
        setAttribute( "h", AjaxRequestHandler.class.getName() );

        return this;
    }
}
